using Sirenix.OdinInspector;
using System;
using System.Collections.Generic;
using UnityEngine;

namespace IQIGame.Onigao.GamePlay.Editors
{
    [CreateAssetMenu(fileName = "EntityGenConfigAsset", menuName = "Create Scriptable Config/EntityGenConfigAsset(创建实体预制体生成配置)")]
    [ShowOdinSerializedPropertiesInInspector]
    public class EntityGenConfigAsset : ScriptableObject
    {
        [SerializeField]
        public ArtModeGenType genAnimatorType;
        [SerializeField]
        public float modelScale = 1;


        [Serializable]
        /// <summary>
        /// 特效或者其他GameObject的绑定
        /// </summary>
        public class EntityEffectBind
        {
            public GameObject gameObject;
            public string bindPath;
            public Vector3 localPosition = Vector3.zero;
            public bool defaultActive;
            public ArtModeGenTypeFlag genType = (ArtModeGenTypeFlag)0xFF;
            public bool holdRotation;
            public List<EntityEffectStateBind> effectAnimStateBinds;
        }

        [Serializable]
        public class BindRootTrans
        {
            public string rootName;
            public int defaultTransY = 0;
        }

        [Serializable]
        public struct BindingCompData
        {
            public EntityGenBindingComponentType type;
            public string parmas;
        }

        public List<BindRootTrans> bindRootTransList = new List<BindRootTrans>();
        public List<EntityEffectBind> effectBinds = new List<EntityEffectBind>();

        [Serializable]
        /// <summary>
        /// 特殊的Object处理
        /// </summary>        
        public class EntityObjectProcess
        {
            public string path;
            public bool defaultActive;
            public List<EntityEffectStateBind> effectAnimStateBinds;
        }
        public List<EntityObjectProcess> objectProcesses = new List<EntityObjectProcess>();

        /// <summary>
        /// 动画资源相关
        /// </summary>
        public List<EntityAnimConfig> entityAnimConfigs = new List<EntityAnimConfig>();

        /// <summary>
        /// 自定义组件处理
        /// </summary>
        public List<BindingCompData> entityComponentConfigs = new List<BindingCompData>();

        /// <summary>
        /// 带视效的状态（美术通过Timeline编辑，程序用特殊方式实现，这里的视效专指shader效果，而非粒子特效）
        /// </summary>
        [Serializable]
        public class AniamtorCustomVFX
        {
            [LabelText("状态名")]
            public string stateName;
            [LabelText("播放 VFX Group")]
            public string vfxGroup;
            [LabelText("播放延迟（秒）")]
            public float delay;
        }

        [LabelText("自定义VFX状态")]
        public List<AniamtorCustomVFX> customVFXStates = new();
    }
}
